export function modalDrag() {
  let header = document.getElementsByClassName("ant-modal-header");
  let footer = document.getElementsByClassName("ant-modal-footer");
  // console.log(header)
  // var len = header.length?header.length:0;
  header[0].onmousedown = function (e) {
    var el = e || window.event;                  //兼容IE浏览器
    var oDiv = el.target.offsetParent;           //替换属性；ie中MouseEvent中没有path属性，so替换(兼容谷歌和ie)
    var disX = el.clientX - oDiv.offsetLeft;
    var disY = el.clientY - oDiv.offsetTop;
    if (typeof oDiv.setCapture !== 'undefined') {       // setCapture，relaseCapture，这一对方法就是用来设置元素对鼠标事件的捕捉和释放的。
      oDiv.setCapture();
    }
    document.onmousemove = function (e) {
      var el2 = e || window.event;                //兼容IE浏览器
      el2.preventDefault();
      var l = el2.clientX - disX;
      var t = el2.clientY - disY;
      oDiv.style.left = l + "px"
      oDiv.style.top = t + "px"
    }
    document.onmouseup = function () {
      document.onmousemove = null;
      document.onmouseup = null;
      //修复低版本ie bug
      if (typeof oDiv.releaseCapture !== 'undefined') {
        oDiv.releaseCapture();
      }
    }
  }
  footer[0].onmousedown = function (e) {
    var el = e || window.event;                  //兼容IE浏览器
    var oDiv = el.target.offsetParent;           //替换属性；ie中MouseEvent中没有path属性，so替换(兼容谷歌和ie)
    var disX = el.clientX - oDiv.offsetLeft;
    var disY = el.clientY - oDiv.offsetTop;
    if (typeof oDiv.setCapture !== 'undefined') {       // setCapture，relaseCapture，这一对方法就是用来设置元素对鼠标事件的捕捉和释放的。
      oDiv.setCapture();
    }
    document.onmousemove = function (e) {
      var el2 = e || window.event;                //兼容IE浏览器
      el2.preventDefault();
      var l = el2.clientX - disX;
      var t = el2.clientY - disY;
      oDiv.style.left = l + "px"
      oDiv.style.top = t + "px"
    }
    document.onmouseup = function () {
      document.onmousemove = null;
      document.onmouseup = null;
      //修复低版本ie bug
      if (typeof oDiv.releaseCapture !== 'undefined') {
        oDiv.releaseCapture();
      }
    }
  }
}